package com.mcj.tokendemo.controller;

import com.mcj.tokendemo.entity.ResponseResult;
import com.mcj.tokendemo.entity.User;
import com.mcj.tokendemo.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {

	@Autowired
	private LoginService loginService;
	
	@PostMapping("/user/login")
	public ResponseResult login(@RequestBody User user) {
		// 登录
		
		return loginService.login(user);
	}

	@RequestMapping("/user/logout")
	public ResponseResult logout() {
		return loginService.logout();
	}
}
